package com.darsn.fowtle.core.service;

import org.springframework.stereotype.Service;

import com.darsn.fowtle.core.common.Guard;
import com.darsn.fowtle.core.domain.User;
import com.darsn.fowtle.core.repository.UserRepository;

@Service
public class UserServiceImpl implements UserService {

	private UserRepository userRepository;
	
	public void setUserRepository(UserRepository userRepository) {
		this.userRepository = userRepository;
	}
	
	@Override
	public User login(String username, String password) {
		Guard.assertNotNull(username, "username");
		Guard.assertNotNull(password, "password");
		
		Guard.assertNotBlank(username, "username");
		Guard.assertNotBlank(password, "password");
		
		return userRepository.findUser(username, password);
	}

}
